

use "06_goldstein_rivers_tomz_2007/replication_data.dta", clear
* Change path as needed


* Create dummy variables for GATT/WTO participation

* GATT: Formal membership
gen byte gattF_1 = cond(gatt_1=="wto"|gatt_1=="art33"|gatt_1=="orig"|gatt_1=="art26:5", 1, 0)  /* GATT: Country 1 is formal member */
gen byte gattF_2 = cond(gatt_2=="wto"|gatt_2=="art33"|gatt_2=="orig"|gatt_2=="art26:5", 1, 0)  /* GATT: Country 2 is formal member */

* GATT: Nonmember participant
gen byte gattN_1 = cond(gatt_1=="col"|gatt_1=="df"|gatt_1=="prov", 1, 0) /* GATT: Country 1 is a NMP */
gen byte gattN_2 = cond(gatt_2=="col"|gatt_2=="df"|gatt_2=="prov", 1, 0) /* GATT: Country 2 is a NMP */

* GATT: Participation (either formal or de facto)
gen byte gattP_1 = cond(gatt_1=="out", 0, 1) /* GATT: Country 1 participates */
gen byte gattP_2 = cond(gatt_2=="out", 0 ,1) /* GATT: Country 2 participates */

* GATT: Interactions
gen byte gattPP = cond(gattP_1==1 & gattP_2==1, 1, 0)
label var gattPP "GATT: Both Participate"
gen byte gattPO = cond((gattP_1==1 & gattP_2==0)|(gattP_1==0 & gattP_2==1), 1, 0)
label var gattPO "GATT: Only one participates"
gen byte gattFF = cond(gattF_1==1 & gattF_2==1,1,0)
label var gattFF "GATT: Both are formal members"
gen byte gattFN = cond((gattF_1==1 & gattN_2==1)|(gattN_1==1 & gattF_2==1),1,0)
label var gattFN "GATT: One formal, one NMP"
gen byte gattFO = cond((gattF_1==1 & gattP_2==0)|(gattP_1==0 & gattF_2==1),1,0)
label var gattFO "GATT: One formal, other is out"
gen byte gattNN = cond(gattN_1==1 & gattN_2==1,1,0)
label var gattNN "GATT: Both nonmbr participants"
gen byte gattNO = cond((gattN_1==1 & gattP_2==0)|(gattP_1==0 & gattN_2==1),1,0)
label var gattNO "GATT: One NMP, other is out"
drop gattF_1 gattF_2 gattN_1 gattN_2 gattP_1 gattP_2 





*** Table 4: The effect of GATT/WTO membership on trade
* Ordinary least squares

* Original: Goldstein et al's table 1, model 1
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit gdp distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model1, title("Original Model")

* Using WDI 2005 data
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant2000_wdi distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model2, title("WDI 2005")

* Using PWT 6.1 data
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant1996_pwt distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model3, title("PWT 6.1")

* Using Maddison data
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant_maddison distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model4, title("Maddison 2003")

* Export
esttab model1 model2 model3 model4 using results.tex, mtitle star(* 0.1 ** 0.05 *** 0.01) b(3) se stats(rmse r2 N) nogaps replace




use "06_goldstein_rivers_tomz_2007/replication_data_complete_observations.dta", clear
* Change path as needed


* Create dummy variables for GATT/WTO participation

* GATT: Formal membership
gen byte gattF_1 = cond(gatt_1=="wto"|gatt_1=="art33"|gatt_1=="orig"|gatt_1=="art26:5", 1, 0)  /* GATT: Country 1 is formal member */
gen byte gattF_2 = cond(gatt_2=="wto"|gatt_2=="art33"|gatt_2=="orig"|gatt_2=="art26:5", 1, 0)  /* GATT: Country 2 is formal member */

* GATT: Nonmember participant
gen byte gattN_1 = cond(gatt_1=="col"|gatt_1=="df"|gatt_1=="prov", 1, 0) /* GATT: Country 1 is a NMP */
gen byte gattN_2 = cond(gatt_2=="col"|gatt_2=="df"|gatt_2=="prov", 1, 0) /* GATT: Country 2 is a NMP */

* GATT: Participation (either formal or de facto)
gen byte gattP_1 = cond(gatt_1=="out", 0, 1) /* GATT: Country 1 participates */
gen byte gattP_2 = cond(gatt_2=="out", 0 ,1) /* GATT: Country 2 participates */

* GATT: Interactions
gen byte gattPP = cond(gattP_1==1 & gattP_2==1, 1, 0)
label var gattPP "GATT: Both Participate"
gen byte gattPO = cond((gattP_1==1 & gattP_2==0)|(gattP_1==0 & gattP_2==1), 1, 0)
label var gattPO "GATT: Only one participates"
gen byte gattFF = cond(gattF_1==1 & gattF_2==1,1,0)
label var gattFF "GATT: Both are formal members"
gen byte gattFN = cond((gattF_1==1 & gattN_2==1)|(gattN_1==1 & gattF_2==1),1,0)
label var gattFN "GATT: One formal, one NMP"
gen byte gattFO = cond((gattF_1==1 & gattP_2==0)|(gattP_1==0 & gattF_2==1),1,0)
label var gattFO "GATT: One formal, other is out"
gen byte gattNN = cond(gattN_1==1 & gattN_2==1,1,0)
label var gattNN "GATT: Both nonmbr participants"
gen byte gattNO = cond((gattN_1==1 & gattP_2==0)|(gattP_1==0 & gattN_2==1),1,0)
label var gattNO "GATT: One NMP, other is out"
drop gattF_1 gattF_2 gattN_1 gattN_2 gattP_1 gattP_2 



*** Table 5: The effect of GATT/WTO membership on trade
* Ordinary least squares
* Reducing all vintages to the common denominator

* Original: Goldstein et al's table 1, model 1
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit gdp distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model5, title("Original Model")

* Using WDI 2005 data
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant2000_wdi distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model6, title("WDI 2005")

* Using PWT 6.1 data
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant1996_pwt distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model7, title("PWT 6.1")

* Using Maddison data
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant_maddison distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model8, title("Maddison 2003")

* Export
esttab model5 model6 model7 model8 using results.tex, mtitle star(* 0.1 ** 0.05 *** 0.01) b(3) se stats(rmse r2 N) nogaps replace




******** APPENDIX ********

use "06_goldstein_rivers_tomz_2007/replication_data.dta", clear
* Change path as needed


* Create dummy variables for GATT/WTO participation

* GATT: Formal membership
gen byte gattF_1 = cond(gatt_1=="wto"|gatt_1=="art33"|gatt_1=="orig"|gatt_1=="art26:5", 1, 0)  /* GATT: Country 1 is formal member */
gen byte gattF_2 = cond(gatt_2=="wto"|gatt_2=="art33"|gatt_2=="orig"|gatt_2=="art26:5", 1, 0)  /* GATT: Country 2 is formal member */

* GATT: Nonmember participant
gen byte gattN_1 = cond(gatt_1=="col"|gatt_1=="df"|gatt_1=="prov", 1, 0) /* GATT: Country 1 is a NMP */
gen byte gattN_2 = cond(gatt_2=="col"|gatt_2=="df"|gatt_2=="prov", 1, 0) /* GATT: Country 2 is a NMP */

* GATT: Participation (either formal or de facto)
gen byte gattP_1 = cond(gatt_1=="out", 0, 1) /* GATT: Country 1 participates */
gen byte gattP_2 = cond(gatt_2=="out", 0 ,1) /* GATT: Country 2 participates */

* GATT: Interactions
gen byte gattPP = cond(gattP_1==1 & gattP_2==1, 1, 0)
label var gattPP "GATT: Both Participate"
gen byte gattPO = cond((gattP_1==1 & gattP_2==0)|(gattP_1==0 & gattP_2==1), 1, 0)
label var gattPO "GATT: Only one participates"
gen byte gattFF = cond(gattF_1==1 & gattF_2==1,1,0)
label var gattFF "GATT: Both are formal members"
gen byte gattFN = cond((gattF_1==1 & gattN_2==1)|(gattN_1==1 & gattF_2==1),1,0)
label var gattFN "GATT: One formal, one NMP"
gen byte gattFO = cond((gattF_1==1 & gattP_2==0)|(gattP_1==0 & gattF_2==1),1,0)
label var gattFO "GATT: One formal, other is out"
gen byte gattNN = cond(gattN_1==1 & gattN_2==1,1,0)
label var gattNN "GATT: Both nonmbr participants"
gen byte gattNO = cond((gattN_1==1 & gattP_2==0)|(gattP_1==0 & gattN_2==1),1,0)
label var gattNO "GATT: One NMP, other is out"
drop gattF_1 gattF_2 gattN_1 gattN_2 gattP_1 gattP_2 


*** Table C.1: The effect of GATT/WTO membership on trade
* Ordinary least squares

* Original: Goldstein et al's table 1, model 1
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit gdp distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model9, title("Original Model")

* Combining new data: WDI 2022, PWT 10.01, UN Data 2023, MOxLAD 2023, Maddison 2020
* Base year 1967 (like the authors')
* I do not report this model because UN Data are only available since 1970, so it is only possible to rebase these data when using a deflator from a different source 
* To generate the variable log_gdp_constant1967_combined, I rebased UN Data using the WDI deflator, but this leads to a loss of >86k observations
* areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant1967_combined distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust

* Combining new data: WDI 2022, PWT 10.01, UN Data 2023, MOxLAD 2023, Maddison 2020
* Base year 2010
areg imports gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant2010_combined distance share_language share_border landlocked island land_area, absorb(year) cluster(directed_dyad_id) robust
eststo model10, title("WDI 2022, PWT 10.01, and Others")

* Export
esttab model9 model10 using results.tex, mtitle star(* 0.1 ** 0.05 *** 0.01) b(3) se stats(rmse r2 N) nogaps replace




*** Table C.2: The effect of GATT/WTO membership on trade, including dyad and year effects
* Ordinary least squares

* Create year dummies
quietly tab year, gen(yeardummy)

* Original: Goldstein et al's table 1, model 2
areg import gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit gdp yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model11, title("Original Model")

* Using WDI 2005
areg import gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant2000_wdi yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model12, title("WDI 2005")

* Using PWT 6.1
areg import gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant1996_pwt yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model13, title("PWT 6.1")

* Using Maddison 2003
areg import gattFF gattFO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant_maddison yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model14, title("Maddison 2003")

* Export
esttab model11 model12 model13 model14 using results.tex, mtitle star(* 0.1 ** 0.05 *** 0.01) b(3) se stats(rmse r2 N) drop(yeardummy*) nogaps replace




*** Table C.3: The effect of GATT/WTO membership on trade, using different membership/participation measures
* Ordinary least squares

* Goldstein et al's table 2, model 1
areg imports gattFF gattNN gattFN gattFO gattNO ptarecip ptanonrecip gsp currencyunion colorbit gdp yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model15, title("Original Model")

* Using WDI 2005
areg imports gattFF gattNN gattFN gattFO gattNO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant2000_wdi yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model16, title("WDI 2005")

* Using PWT 6.1
areg imports gattFF gattNN gattFN gattFO gattNO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant1996_pwt yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model17, title("PWT 6.1")

* Using Maddison 2003
areg imports gattFF gattNN gattFN gattFO gattNO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant_maddison yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model18, title("Maddison 2003")

* Goldstein et al's table 2, model 2
areg imports gattPP gattPO ptarecip ptanonrecip gsp currencyunion colorbit gdp yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model19, title("Original Model")

* Using WDI 2005
areg imports gattPP gattPO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant2000_wdi yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model20, title("WDI 2005")

* Using PWT 6.1
areg imports gattPP gattPO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant1996_pwt yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model21, title("PWT 6.1")

* Using Maddison 2003
areg imports gattPP gattPO ptarecip ptanonrecip gsp currencyunion colorbit log_gdp_constant_maddison yeardummy*, absorb(directed_dyad_id) cluster(directed_dyad_id) robust
eststo model22, title("Maddison 2003")

* Export
esttab model15 model16 model17 model18 model19 model20 model21 model22 using results.tex, mtitle star(* 0.1 ** 0.05 *** 0.01) b(3) se stats(rmse r2 N) drop(yeardummy*) nogaps replace
